﻿using System.IO;
using Presenter;

namespace Infrastructure
{
    public class LoggerToHtml : ILogger
    {
        public string logFile { get; set; }

        public LoggerToHtml()
        {
            logFile = "log.html";
            StreamWriter writer = new StreamWriter(logFile, false);
            writer.Close();
        }

        public string Read()
        {
            StreamReader reader = new StreamReader(logFile);
            string logString = reader.ReadToEnd();
            reader.Close();
            return logString;
        }

        public void Write(string message)
        {
            StreamWriter writer = new StreamWriter(logFile, true);
            writer.Write(message + "<br>" + "\r\n");
            writer.Close();
        }
    }
}
